package com.example.ailiyuncloud;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.stereotype.Component;

import java.net.InetAddress;

@SpringBootApplication
@EnableScheduling
@MapperScan({ "com.example.ailiyuncloud.mapper" })
public class AiliyunCloudApplication {

    public static void main(String[] args) {
        SpringApplication.run(AiliyunCloudApplication.class, args);
//        try {
//            ConfigurableApplicationContext application = SpringApplication.run(AiliyunCloudApplication.class, args);
//            Environment env = application.getEnvironment();
//            String ip = InetAddress.getLocalHost().getHostAddress();
//            String port = env.getProperty("server.port");
//            String path = env.getProperty("server.servlet.context-path");
//            System.out.println("\n----------------------------------------------------------\n\t" +
//                    "Application MxpIO is running! Access URLs:\n\t" +
//                    "Local: \t\thttp://localhost:" + port + path + "/\n\t" +
//                    "External: \thttp://" + ip + ":" + port + path + "/\n\t" +
//                    "----------------------------------------------------------");
//        }catch (Exception e){
//
//        }

    }

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

}
